package com.dashunzi.yueyutianqi.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Administrator on 2016/4/10 0010.
 * 作者：大顺子
 */
public abstract class BaseFragment extends Fragment {
    //fragment创建
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    //处理fragment的布局
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return initView();
    }


    //当Activity中的onCreate方法执行完后调用
    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    /**
     * 子类必须实现,初始化布局的方法,所以抽象
     *
     * @return
     */
    public abstract View initView();

    /**
     * 初始化数据 ,可有可无
     */
    public void initData() {

    }
}
